package cn.com.computer.common.enums;

/**
 * Created by WANGXin on 2017/5/18.
 */
public enum LanguageEnum {
    CHINESE("CHINESE","中文"),
    JAPANESE("JAPANESE","日文"),
    YUEYU("粤语","粤语"),
    ENGLISH("ENGLISH","英文");


    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getName(String code) {
        if (code == null) {
            return null;
        }
        for (LanguageEnum e : LanguageEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }
    public static String getValue(String desc) {
        if (desc == null) {
            return null;
        }
        for (LanguageEnum e : LanguageEnum.values()) {
            if (e.getDesc().equals(desc)) {
                return e.getCode();
            }
        }
        return null;
    }

    LanguageEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
